<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            perspective: 400px;
        }
        .box{
            position: relative;
            width: 200px;
            height: 200px;
            margin:100px auto;
            transform-style: preserve-3d;
           transition: all 3s;

        }
        .box div{
            position: absolute;
            width: 100%;
            height: 100%;
            left:0;
            right:0;
            background-color:pink;
        }
        .box div:last-child{
            background-color:royalblue;
            transform: rotateX(45deg);
        }
        .box:hover{
            transform: rotateY(-60deg);
        }
    </style>
</head>
<body>
    <div class="box">
        <div></div>
        <div></div>
    </div>
</body>
</html>